//
//  ShareView.m
//  EquiriesProject
//
//  Created by qianfeng on 15/10/31.
//  Copyright (c) 2015年 HXH. All rights reserved.
//

#import "ShareView.h"

@interface ShareView ()

@end

@implementation ShareView

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title=@"发送微博";
    [self creatNav];
    [self creatNavBar];
    [_Send addTarget:self action:@selector(send) forControlEvents:UIControlEventTouchUpInside];
    
    _Text.text=_model.title;
    
}

-(void)send
{
    [Fundction postWeiboWithContent:_Text.text andBlock:^(id obj, NSError *error) {
        
    }];
    self.block();
//    [self.navigationController popViewControllerAnimated:YES];
    [self dismissViewControllerAnimated:YES completion:nil];
    
}

-(void)creatNav
{
    UINavigationBar * bar=self.navigationController.navigationBar;
    [bar setBackgroundImage:[UIImage imageNamed:@"custom_dialog_btn_bg"] forBarMetrics:UIBarMetricsDefault];
    [self.view addSubview:bar];
    
}
-(void)creatNavBar
{
    UIButton * left=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 20, 20)];
    
    [left setBackgroundImage:[UIImage imageNamed:@"back_normal"] forState:UIControlStateNormal];
    [left addTarget:self action:@selector(leftButton) forControlEvents:UIControlEventTouchUpInside];
    
    
    UIBarButtonItem * leftItem=[[UIBarButtonItem alloc]initWithCustomView:left];
    self.navigationItem.leftBarButtonItem=leftItem;
}

-(void)leftButton
{
//    NSArray * a1 = self.navigationController.viewControllers;
//    
//    [self.navigationController popToViewController:a1[0] animated:YES];
    
    [self dismissViewControllerAnimated:YES completion:nil];
    
    //[self.navigationController popViewControllerAnimated:YES];

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
